#include "kernel/lactate.hpp"
#include "yocto/lua/lua-config.hpp"

Lactate:: ~Lactate() throw()
{
	
}

Lactate:: Lactate( lua_State *L ) :
Enzyme(L, "Lactate", "lactateProduction"),
Km( Lua::Config::Get<lua_Number>(L,"LaKm") ),
sAH( "HA" ),
sAm( "A-" ),
sH( "H+" ),
sNa( "Na+" )
{
	V =  Lua::Config::Get<lua_Number>(L,"LaVm");
}

BIO_PH_ENZYME_CALL(Lactate::)
{
	//const Real AH = S_in[ sAH ];
    const Real Am  = S_in[ sAm ];
	const Real rho = V * Am / (Km+Am);
    const Real eff = efficiency(t);
    
    //dS[ sAH ] += eff - rho;
    
    if( eff > 0 )
        dS[ sAH ] += eff;
    else
        dS[ sAH ] -= rho;
    
    
   	return 0.0;
}
